<template>
	<view class="refuse_msg">
		<view class="msg_main">
			<u-input v-model="value" type="textarea" height='400' :clearable='false' placeholder='请输入拒绝原因' />
		</view>
		<!-- 底部 -->
		<BottomBtn title='提交' @submit='submitBtn'></BottomBtn>
	</view>
</template>

<script>
	import BottomBtn from '@/components/bottom_btn/bottom_btn.vue';
	export default {
		components:{
			BottomBtn
		},
		data() {
			return {
				id:'',
				type:0,//0=仓储 1=进货 2=等级
				value:'',
			};
		},
		onLoad(opt) {
			this.id=opt.id
			this.type=opt.type
		},
		methods:{
			submitBtn(){
				var that = this
				if(that.value==''){
					that.$tips.showToast('请输入拒绝原因')
					return
				}else if(that.type==0){
					// 仓储
					that.$tips.showLoading('加载中')
					var params = {
						order_id:that.id,
						shop_status:4,
						refuse_msg:that.value
					}
					that.$httpApi.goodsOrderAudit(params).then((res)=>{
						that.$tips.hideLoading()
						if(res.code==1){
							that.$tips.showToast('拒绝成功')
							setTimeout(function(){
								uni.navigateBack()
							},2000)
						}
					})
				}else if(that.type==1){
					// 进货
					that.$tips.showLoading('加载中')
					var params = {
						order_id:that.id,
						status:2,
						refuse_msg:that.value
					}
					that.$httpApi.shopOrderAudit(params).then((res)=>{
						that.$tips.hideLoading()
						if(res.code==1){
							that.$tips.showToast('拒绝成功')
							setTimeout(function(){
								uni.navigateBack()
							},2000)
						}
					})
				}else if(that.type==2){
					// 等级
					that.$tips.showLoading('加载中')
					var params = {
						id:that.id,
						status:3,
						refuse_msg:that.value
					}
					that.$httpApi.shopUserAudit(params).then((res)=>{
						that.$tips.hideLoading()
						if(res.code==1){
							that.$tips.showToast('拒绝成功')
							setTimeout(function(){
								uni.navigateBack()
							},2000)
						}
					})
				}else if(that.type==3){
					// 提现
					that.$tips.showLoading('加载中')
					var params = {
						ids:that.id,
						status:3,
						refuse_msg:that.value
					}
					that.$httpApi.userWithdraAudit(params).then((res)=>{
						that.$tips.hideLoading()
						if(res.code==1){
							that.$tips.showToast('拒绝成功')
							setTimeout(function(){
								uni.navigateBack()
							},2000)
						}
					})
				}
			},
		}
	}
</script>

<style lang="less">
	.refuse_msg{
		width: 100%;
		padding-top: 24rpx;
		.msg_main{
			width: 100%;
			padding: 24rpx 32rpx;
			background: #fff;
		}
	}
</style>
